﻿

<!--********************* Part1:Jsp Head *********************-->

<%@ page contentType="text/html;charset=UTF-8"%> 
<%@ include file="/framework/head.jsp"%>

<!--********************* Part2:Java Code *********************-->
<% 
    
    ProductSearchEvent event = (ProductSearchEvent)context.getSessionValue("ProductSearchEvent");
    String categoryCode = (String)context.getValue("categoryCode");
    String isFirst = (String)context.getValue("isFirst");
    String warehouseCode = (String)context.getValue("warehouseCode");

    if(categoryCode ==null) categoryCode="";
    ObjectList list = ObjectList.getList();

    if(isFirst!=null&&isFirst.equals("1")){
        list = Product.fetch().search(con,event); 
    }
    String warehouseCategoryId =  String.valueOf(context.getSessionValue("warehouseCategoryId"));
%>

<!--********************* Part3:JavaScript Code ***************-->
<!--start 客户端脚本区域-->
<script language=javascript>
var list_code = "addProduct";
function doSearch()
{      var startHour=document.getElementById("startHour").selectedIndex;
    if(startHour <10){
        startHour=" 0"+startHour+":00:00";
        }else{ 
        startHour=" "+startHour+":00:00";   
        }    
    var endHour=(document.getElementById("endHour").selectedIndex);
    if(endHour <10){
        endHour=" 0"+endHour+":59:59";
        }else{ 
        endHour=" "+endHour+":59:59";  
        }  
    SetValue("s_ConcentricityCode",GetValue("i_ConcentricityCode")); //产品编码
    SetValue("s_Name",GetValue("i_Name")); //产品名称
    SetValue("s_Spec",GetValue("i_Spec")); //规格
    SetValue("s_Model",GetValue("i_Model")); //型号
    SetValue("s_ProductBrand",GetValue("i_ProductBrand")); //品牌
    SetValue("s_Manufaturer",GetValue("i_Manufaturer")); //生产厂商
    SetValue("s_ProviderCode",GetValue("i_ProviderCode")); //供应商
    SetValue("s_DrawingPieceCode",GetValue("i_DrawingPieceCode")); //图件号
    SetValue("s_KeyWord",GetValue("i_KeyWord"));//关键字
    SetValue("s_WarehouseCode",GetValue("i_WarehouseCode")); //所属仓库
    SetValue("s_IsNormal",GetValue("i_IsNormal")); //是否正式产品
    SetValue("s_IsTradeflatProduct",GetValue("i_IsTradeflatProduct")); //数据类型
    SetValue("s_Status",GetValue("i_Status")); //是否有效
    SetValue("s_IsBuy",GetValue("i_IsBuy")); //是否可采购
    SetValue("s_OrderField",GetValue("i_OrderField")); //排序
    SetValue("s_OrderDesc",getCheckBoxValues("i_OrderDesc")); //升降序
   // SetValue("s_UpperCategoryCode",GetValue("i_UpperCategoryCode")); //产品分类编码
    <%/**String str1 = String.valueOf(context.getSessionValue("warehouseCategoryId"));*/%>
    SetValue("warehouseCategoryId","<%=warehouseCategoryId%>");
    SetValue("s_CreateTimeStart",GetValue("i_CreateTimeStart")==""?"":GetValue("i_CreateTimeStart")+startHour); //出库开始日期
    
    SetValue("s_CreateTimeEnd",GetValue("i_CreateTimeEnd")==""?"":GetValue("i_CreateTimeEnd")+endHour); //出库结束日期
    SetValue("isWarehouseCategoryProduct","1");
    SetValue("categoryCode","<%=categoryCode%>");
    SetValue("warehouseCode","<%=warehouseCode%>");
    SetValue("categoryCode","<%=categoryCode%>");
    SetValue("isFirst","1");
    doCommonSearch();
}

function bizViewProduct(id)
{
    viewWin("<%=Config.getSrv()%>?action_code=viewProduct&Id="+id);
}

function doToAdd()
{
    if(!hasChooseRadio("ids"))
    {
        bizMessage("添加","产品");
        return false;
    }
    // SetValue("categoryName",getHiddenValue("categoryName"));
    SetValue("categoryCode","<%=categoryCode%>");
    SetValue("warehouseCode","<%=warehouseCode%>");
    SetAction("toAddWarehouseCategoryRelation");
    SetValue("warehouseCategoryId","<%=warehouseCategoryId%>");
    frm.submit();
}
function doExcel(){
    <%if(list.getTotalSize()>20000){%>
        alert("导出EXCEL产品数量不能超过20000条！");
        return false;
    <%}else{%>
        window.location.href="<%=Config.getWebPath()%>/GSproductDown";
    <%}%>
}

key_InitDefault();
key_RegSubmitHandler(doSearch);
</script>
<%=uiBody%>>

<%@ include file="/framework/menu.jsp"%>

<!--********************* Part4:Form  ***************-->
<form id=frm action="<%=Config.getSrv()%>" method="post">
<input type=hidden name="action_code" value="">
<input type=hidden name="Id" value="">
<input type=hidden name=sortOrder value="1">
<input type=hidden name="categoryCode" value="">
<input type=hidden name="warehouseCode" value="">

<!--查询条件保留区域-->
<input type=hidden name="s_ConcentricityCode" value="<%=event.getConcentricityCode()%>"> <!--产品编码-->
<input type=hidden name="s_Name" value="<%=event.getName()%>"> <!--产品名称-->
<input type=hidden name="s_Spec" value="<%=event.getSpec()%>"> <!--规格-->
<input type=hidden name="s_Model" value="<%=event.getModel()%>"> <!--型号-->
<input type=hidden name="s_ProductBrand" value="<%=event.getProductBrand()%>"> <!--品牌-->
<input type=hidden name="s_Manufaturer" value="<%=event.getManufaturer()%>"> <!--生产厂商-->
<input type=hidden name="s_ProviderCode" value="<%=event.getProviderCode()%>"><!--供应商-->
<input type=hidden name="s_DrawingPieceCode" value="<%=event.getDrawingPieceCode()%>"> <!--图件号-->
<input type=hidden name="s_KeyWord" value = "<%=event.getKeyWord()%>"><!-- 关键字 -->
<input type=hidden name="s_WarehouseCode" value="<%=event.getWarehouseCode()%>"><!--所属仓库-->
<input type=hidden name="s_IsNormal" value="<%=event.getIsNormal()%>"> <!--是否正式产品-->
<input type=hidden name="s_IsTradeflatProduct" value="<%=event.getIsTradeflatProduct()%>"> <!--数据类型-->
<input type=hidden name="s_Status" value="<%=event.getStatus()%>"> <!--是否有效-->
<input type=hidden name="s_IsBuy" value="<%=event.getIsBuy()%>"> <!--是否可采购-->
<input type=hidden name="warehouseCategoryId" value="<%=warehouseCategoryId%>">
<input type=hidden name="isWarehouseCategoryProduct" value="1">
<input type=hidden name="isFirst" value="1">
<input type=hidden name="s_CreateTimeStart" value="<%=event.getCreateTimeStart()%>"> <!--出入库开始日期-->
<input type=hidden name="s_CreateTimeEnd" value="<%=event.getCreateTimeEnd()%>"> <!--出入库结束日期-->
<%@ include file="/framework/list_head.jsp"%>

<br>
<!--********************* Part5:Search Area ***************-->
<%=uiSearchStart%>>
<%
    int key_tab = 1 ;
%>

    <%=uiSearchInputTR%>>
        <%=uiSearchInputTDHead%>>
           产品编码：&nbsp;&nbsp;
         <input type="text" class="texts" name="i_ConcentricityCode" size="20" value="<%=event.viewConcentricityCode()%>" key_tab="<%=key_tab++%>">
         &nbsp;&nbsp;&nbsp;&nbsp;产品名称：&nbsp;&nbsp;&nbsp;&nbsp;
         <input type="text" class="texts" name="i_Name" size="20" value="<%=event.viewName()%>" key_tab="<%=key_tab++%>">
         &nbsp;&nbsp;&nbsp;&nbsp;规格: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
         <input type="text" class="texts" name="i_Spec" size="20" value="<%=event.viewSpec()%>" key_tab="<%=key_tab++%>">
        </td>        
    </tr>   
    <%=uiSearchInputTR%>>
        <%=uiSearchInputTDHead%>>
            型号：&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
          <input type="text" class="texts" name="i_Model" size="20" value="<%=event.viewModel()%>" key_tab="<%=key_tab++%>">
          &nbsp;&nbsp;&nbsp;&nbsp;品牌：&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
          <input type="text" class="texts" name="i_ProductBrand" size="20" value="<%=event.viewProductBrand()%>" key_tab="<%=key_tab++%>">
          &nbsp;&nbsp;&nbsp;&nbsp;生产厂商：&nbsp;&nbsp;
          <input type="text" class="texts" name="i_Manufaturer" size="20" value="<%=event.viewManufaturer()%>" key_tab="<%=key_tab++%>">
        </td>              
    </tr>
    <%=uiSearchInputTR%>>
        <%=uiSearchInputTDHead%>>
            供应商：&nbsp;&nbsp;&nbsp;&nbsp;
          <input type="text" class="texts" name="i_ProviderCode" size="20" value="<%=event.getProviderCode()%>" key_tab="<%=key_tab++%>">
          &nbsp;&nbsp;&nbsp;&nbsp;图件号：&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
          <input type="text" class="texts" name="i_DrawingPieceCode" size="20" value="<%=event.viewDrawingPieceCode()%>" key_tab="<%=key_tab++%>">
        </td>          
    </tr>
    
     <%=uiSearchInputTR%>>
        <%=uiSearchInputTDHead%>>
            关键字：&nbsp;&nbsp;&nbsp;&nbsp;
          <input type="text" class="texts" name="i_KeyWord" size="20" value="<%=event.viewKeyWord()%>" key_tab="<%=key_tab++%>">
          <% out.print("(对产品编码、名称、型号、规格、品牌、生产厂商、附加属性等七个关键字的模糊查询）");%>           
        </td>
     </tr>
     <%=uiSearchInputTR%>>
        <%=uiSearchInputTDHead%>>
            所属仓库：&nbsp;&nbsp;
          <%=SelectManager.viewWarehouseSelect(con,loginInfo.getLoginWarehouseCode(),"i_WarehouseCode",event.viewWarehouseCode(),true,"",SelectManager.SELECT_ALL,"","key_tab="+(key_tab++))%>
          &nbsp;&nbsp;&nbsp;&nbsp;是否正式产品：
          <%=SelectManager.viewYesOrNoSelect("i_IsNormal",event.viewIsNormal(),true,"",SelectManager.SELECT_ALL,"","key_tab="+(key_tab++))%>
        </td>       
    </tr>
     <%=uiSearchInputTR%>>
    <%=uiSearchInputTR%>>
        <%=uiSearchInputTDHead%>>
            数据类型：&nbsp;&nbsp;
          <%=SelectManager.viewYesOrNoSelectDEALorHAND("i_IsTradeflatProduct",event.viewIsTradeflatProduct(),true,"",SelectManager.SELECT_ALL,"","key_tab="+(key_tab++))%>
          &nbsp;&nbsp;&nbsp;&nbsp;有效性：&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
          <%=SelectManager.viewYesOrNoSelect("i_Status",event.viewStatus(),true,"",SelectManager.SELECT_ALL,"","key_tab="+(key_tab++))%>
          &nbsp;&nbsp;&nbsp;&nbsp;是否可采购：
          <%=SelectManager.viewYesOrNoSelect("i_IsBuy",event.viewIsBuy(),true,"",SelectManager.SELECT_ALL,"","key_tab="+(key_tab++))%>
        </td>          
    </tr>
    <%=uiSearchInputTR%>>
        <%=uiSearchInputTDHead%>>
            出入库时间：&nbsp;&nbsp;
            <%=framework.custom.UIManager.generateDateInput("i_CreateTimeStart", "")%>
              <select id="startHour" >
              <%for(int i=0;i<24;i++){ %>
                <option><%=i %></option>
                <%} %>
              </select>      
                至
             <%=framework.custom.UIManager.generateDateInput("i_CreateTimeEnd", "")%>
              <select id="endHour">
                <option>1</option>
                <option>2</option>
                <option>3</option>
                <option>4</option>
                <option>5</option>
                <option>6</option>
                <option>7</option>
                <option>8</option>
                <option>9</option>
                <option>10</option>
                <option>11</option>
                <option>12</option>
                <option>13</option>
                <option>14</option>
                <option>15</option>
                <option>16</option>
                <option>17</option>
                <option>18</option>
                <option>19</option>
                <option>20</option>
                <option>21</option>
                <option>22</option>
                <option>23</option>
                <option selected="selected">24</option>
              </select> 
         </td>       
    </tr>
    <%=uiSearchInputTR%>>
        <%=uiSearchInputTDHead%>>
            按排序：&nbsp;&nbsp;&nbsp;&nbsp;
       
            <select name="i_OrderField">
                <option value="" <%=(event.getOrderField().equals("1"))?"selected":""%>>设置排序字段</option>
                <option value="CONCENTRICITY_CODE" <%=(event.getOrderField().equals("CONCENTRICITY_CODE"))?"selected":""%>>产品编码</option>
                <option value="NAME" <%=(event.getOrderField().equals("NAME"))?"selected":""%>>产品名称</option>
                <option value="SPEC" <%=(event.getOrderField().equals("SPEC"))?"selected":""%>>规格</option>
                <option value="MODEL" <%=(event.getOrderField().equals("MODEL"))?"selected":""%>>型号</option>
                <option value="PRODUCT_BRAND" <%=(event.getOrderField().equals("PRODUCT_BRAND"))?"selected":""%>>品牌</option>
                <option value="STATUS" <%=(event.getOrderField().equals("STATUS"))?"selected":""%>>是否有效</option>
            </select>
            &nbsp;
            <input type="radio" name="i_OrderDesc" value="false" <%=(event.isOrderDesc()==false)?"checked":""%> >升序
            <input type="radio" name="i_OrderDesc" value="true"  <%=(event.isOrderDesc()==true)?"checked":""%>  >降序
            <input type="button" value="查询" class="buttons" onclick="doSearch();return false;"><input type="button" value="清空" class="buttons" onclick="doClearEvent();return false;">
        </td>
    </tr>

<%=uiSearchEnd%>

<!--列表标题-->
<%=UIManager.addListHeadTitle("产品列表")%>

<!--********************* Part6:List Area ***************-->

<%=uiListStart%>>

<%@ include file="/framework/list_foot.jsp"%>

<%
    int index = 1 ;
%>  
    <%=uiListHeadTR%>>
        <%=UIManager.addListHeadCheckBox() %>
        <%=UIManager.addListHead("产品编码",index++)%>
        <%=UIManager.addListHead("产品名称",index++)%>
        <%=UIManager.addListHead("供应商",index++)%>
        <%=UIManager.addListHead("单价",index++,"num")%>
        <%=UIManager.addListHead("计量单位",index++)%>
        <%=UIManager.addListHead("质保期",index++)%>
        <%=UIManager.addListHead("规格",index++)%>
        <%=UIManager.addListHead("型号",index++)%>
        <%=UIManager.addListHead("品牌",index++)%>
        <%=UIManager.addListHead("生产厂商",index++)%>
        <%=UIManager.addListHead("数据类型",index++)%>
        <%=UIManager.addListHead("有效性",index++)%>
        <%=UIManager.addListHead("所属仓库",index++)%>
        <%=UIManager.addListHead("是否正式产品",index++)%>
        <%=UIManager.addListHead("操作",-1)%>  
    <%=uiListHeadTREnd%>>
    
<!--data-->
   
<%
    for(int i=0;i<list.size();i++)
    {
        Product obj = (Product)list.get(i);
        //Provider obj1 =(Provider)list1.get(i);
%>
    <%=uiListDataTR[i%2]%> align=center>
        <%=uiListDataTD%>>
            <input type="checkbox" name="ids" value="<%=obj.getId()%>">

        </td>
        
        <%=uiListDataTD%>><%=obj.viewConcentricityCode(con)%></td>
        <%=uiListDataTD%>><%=obj.viewName(con)%></td>
        <%=uiListDataTD%>><%=obj.viewProviderCode(con)%></td>
        <%=uiListDataTD%>><%=obj.viewUnitPrice(con)%></td>
        <%=uiListDataTD%>><%=obj.viewProductUnit(con)%></td>
        <%=uiListDataTD%>><%=obj.viewQualityAssurePeriod(con)%></td>
        <%=uiListDataTD%>><%=obj.viewSpec(con)%></td>
        <%=uiListDataTD%>><%=obj.viewModel(con)%></td>
        <%=uiListDataTD%>><%=obj.viewProductBrand(con)%></td>
        <%=uiListDataTD%>><%=obj.viewManufaturer(con)%></td>
        <%=uiListDataTD%>><%=obj.viewIsTradeflatProduct(con)%></td>
        <%=uiListDataTD%>><%=obj.viewStatus(con)%></td>
        <%=uiListDataTD%>><%=obj.viewWarehouseName(con)%></td>
        <%=uiListDataTD%>><%=obj.viewIsNormal(con)%></td>
        
        <%=uiListDataTD%>>
            <a href="" onclick="bizViewProduct('<%=obj.getId()%>');return false;">浏览</a>
        </td>
    </tr>
<%  
    }
%>  

<%@ include file="/framework/list_foot2.jsp"%>

<%=uiListEnd%>
<!--********************* Part7:Action Area ***************-->
<%=uiCommandStart%>>
    <%=uiCommandTR%>>
        <%=uiCommandTD%>>
        <%if(!categoryCode.equals("")) {%>
        <input type=button value="   添加   " class="buttons" onclick="doToAdd();return false;">
        <%} %>
        <input type=button value=" 导出EXCEL " class="buttons" onclick="doExcel();return false;">
           
        </td>
    </tr>   
<%=uiCommandEnd%>
</form>
<!-- 
<script language=javascript>
    selectOnChange1();
    SetValue("i_UpperCategoryCode","<%=event.viewUpperCategoryCode()%>"); //产品分类编码
    selectOnChange2();
    SetValue("i_CategoryCode","<%=event.viewCategoryCode()%>"); //产品分类编码
</script>
 -->
<%@ include file="/framework/foot.jsp"%>
<!--
    Author    :chengbiao.he
    FileName  :/system/base/ProductList.jsp
-->
